package principe.singleresponsibility.singleresponsibility;

public class SingleResponsibility3 {
    public static void main(String[] args) {
        Vehicle2 vehicle2 = new Vehicle2();
        vehicle2.run("驴");
        vehicle2.runWater("鱼");
        vehicle2.runAir("鹰");
    }
}

//方法三：
//1、这种修改方法没有对原来的类做大的修改，只是增加了方法
//2、这里虽然没有在类的级别上遵守单一职责原则，但是在方法的级别上遵守了单一职责原则
class Vehicle2 {
    public void run(String vehicle) {
        System.out.println(vehicle + "在路上爆炸了");
    }

    public void runWater(String vehicle) {
        System.out.println(vehicle + "溺亡了");
    }

    public void runAir(String vehicle) {
        System.out.println(vehicle + "坠机了");
    }
}
